package ui;

import java.util.Arrays;
import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str=scan.next();
        char[] arr=str.toCharArray();
        String str2=scan.next();
        char[] arr2=str2.toCharArray();
        for(int i=0;i<arr2.length;i++){
            if(arr2[i]>='0'&&arr2[i]<='9'){
                int c = Integer.parseInt(String.valueOf(arr2[i]));
                arr2[i]=arr[c];
            }
        }

        System.out.println(new String(arr2));
    }
}
